<?php
/**
* smarty function to get constant value which define before
* @param  name    the constant name
* @param  assign  the assign to variable name
* @return string of value or assign to value if assign param is set
*/
function smarty_function_innoforum_category($params, &$smarty) 
{
    //Get value from page
    $category_id = $params['category_id'];
    $subcategory_id = $params['subcategory_id'];
    if($category_id && !$subcategory_id){
      //Query data
      $sql = "SELECT
                cty_name  
              FROM
                zk_innoforum_category
              WHERE
                cty_id = ".$category_id;

      $column = array("cty_name");
      $result = DBUtil::executeSQL($sql);
      $objectArray = DBUtil::marshallObjects ($result, $column);
      $category = $objectArray['0']['cty_name'];
     
    }
    if ($category) {
        echo $category; 
    } else {
        echo "";
    }
}